Ext.define('AmpleHarvest.objects.Statistics.Window.ReportNav.cTreePanel',
{
	extend				: 'Ext.tree.Panel',
//	uses				: [
	//'AmpleHarvest.Statistics.view.UserByOrg',
	//'AmpleHarvest.Statistics.view.pages.cSolrCount',
	//'AmpleHarvest.Statistics.view.pages.cSourceList',
	//'AmpleHarvest.Statistics.view.pages.cStatus'
//	],
	iconCls				: 'toolbar-statistics-navigation',
	title				: "Navigation",
	height				: 400,
	width				: 200,
	layout				: 'fit',
	rootVisible			: false,

	

	initComponent		: function()
	{
		
		
		this.store = Ext.create('Ext.data.TreeStore',
				{
					root	:
					{
						expanded	: true,
						children	:
						[
						{
							text		: "Pages",
							iconCls		: 'toolbar-statistics-pages',
							expanded	: true,
							children	:
							[
									{
										text		: "Popularity",
										iconCls		: 'toolbar-statistics-table',
										statView	: 'AmpleHarvest.objects.Statistics.view.pages.cPopularity',
										leaf		: true
									}
									,
									{
										text		: "Solr Count",
										iconCls		: 'toolbar-statistics-line-chart',
										statView	: 'AmpleHarvest.objects.Statistics.view.pages.cSolrCount',
										leaf		: true
									},
									{
										text		: "Source List",
										iconCls		: 'toolbar-statistics-table',
										statView	: 'AmpleHarvest.objects.Statistics.view.pages.cSourceList',
										leaf		: true
									},
									{
										text		: "Status",
										iconCls		: 'toolbar-statistics-line-chart',
										statView	: 'AmpleHarvest.objects.Statistics.view.pages.cStatus',
										leaf		: true
									}
							]
						},
						{
							text		: "Users",
							iconCls		: 'toolbar-statistics-user',
							expanded	: true,
							children	:
							[
									{
										text		: "Active Users",
										iconCls		: 'toolbar-statistics-line-chart',
										statView	: 'AmpleHarvest.objects.Statistics.view.users.cActiveUserCount',
										leaf		: true
									},
									{
										text		: "By Organization (Top 5)",
										iconCls		: 'toolbar-statistics-line-chart',
										statView	: 'AmpleHarvest.objects.Statistics.view.UserByOrg',
										leaf		: true
									},
									{
										text		: "By Organization",
										iconCls		: 'toolbar-statistics-pie-chart',
										statView	: 'AmpleHarvest.objects.Statistics.view.UserByOrgPie',
										leaf		: true
									}
							]
						}
					]
				}
			});
					
		this.callParent();
		
		this.on('itemclick', this.handle_Selection, this);
	},

	handle_Selection	: function(obj_View, obj_Record, obj_HTML, int_Index,
			obj_Event, obj_Options)
	{
		if (obj_Record)
		{
			if (obj_Record.raw)
			{
				if (obj_Record.raw.statView)
				{
					m_obj_AmpleHarvest_ViewPort
							.fireEvent(
									AmpleHarvest.eventHandler.cWindowEvents.C_STR_EVENT_STAT_LOAD,
									obj_Record.raw.statView
							);
					// alert(obj_Record.raw.statView);
				}
			}
		}
	}
}
);